package program;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.RenderingHints;
import java.awt.Stroke;
import java.awt.BasicStroke;
import java.awt.font.TextAttribute;
import java.text.AttributedString;

import utils.Point;

import diagramobjects.Actor;
import diagramobjects.ArrowsTextLine;
import diagramobjects.BorderAreaUses;
import diagramobjects.Elipse;
import diagramobjects.InheritanceLine;
import diagramobjects.Line;
import diagramobjects.RealizeLine;
import diagramobjects.RefineLine;
import diagramobjects.SelectionRect;
import diagramobjects.UseCase;


public class PaintObjects {


	public void DrawArrow(Graphics g,Integer BegX, Integer BegY, 
									Integer LeftX, Integer LeftY,
									Integer RightX, Integer RightY, 
									Integer EndX, Integer EndY, 
									Boolean filled)
	{
		
		Polygon p = new Polygon();
		p.addPoint(BegX, BegY);
		p.addPoint(LeftX, LeftY);
		p.addPoint(RightX, RightY);
		p.addPoint(EndX, EndY);
		
		/*java.lang.Math.a
		((Graphics2D)g).rotate(-rotate/**java.lang.Math.PI/180*//*+java.lang.Math.PI/2, posX, posY);
		g.drawString(rotate.toString(), posX, posY);
		g.setColor(new Color(new Float(1.0),new Float(0.0),new Float(0.0),new Float(1.0) ));
		g.drawPolygon(p);
		g.fillPolygon(p);
		((Graphics2D)g).rotate(+rotate/**java.lang.Math.PI/180*//*-java.lang.Math.PI/2, posX, posY);
		*/
		g.drawPolygon(p);
		if (filled)
		{
			g.setColor(new Color(new Float(1.0),new Float(0.0),new Float(0.0),new Float(1.0) ));
			g.fillPolygon(p);
		}
		
	
		
	}
	
	
	
	public void DrawLine(Graphics g, Line l)
	{
		((Graphics2D )g).setStroke(new BasicStroke(2.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND));
		g.setColor(new Color(0,0,0));
		g.drawLine(l.getBeginX(), l.getBeginY(), l.getEndX(), l.getEndY());
	}
	
	public void DrawLineSelection(Graphics g, Line l)
	{
		
		((Graphics2D )g).setStroke(new BasicStroke(2.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND));
		g.setColor(new Color(255,255,255));
		g.fillRect(l.getBeginX()-3, l.getBeginY()-3, 6, 6);
		g.fillRect(l.getEndX()-3, l.getEndY()-3, 6, 6);
		
		
		
	}
	
	public void DrawTextLine(Graphics g, Line l)
	{
		
	}
	
	public void DrawArrowsLineSelection(Graphics g, ArrowsTextLine l)
	{
		
		((Graphics2D )g).setStroke(new BasicStroke(4.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND));
		g.setColor(new Color(0,0,0));
		g.getFont().deriveFont(g.getFont().BOLD);
		
		g.fillRect(l.getBeginX()-5, l.getBeginY()-5, 10, 10);
		g.fillRect(l.getEndX()-5, l.getEndY()-5, 10, 10);
		
		/*g.drawLine(l.getBeginX(), l.getBeginY(), l.getEndX(), l.getEndY());
		((Graphics2D )g).rotate(l.getCaption().GetAlfa() + java.lang.Math.PI/2, l.getCaption().getPosition().getX(), l.getCaption().getPosition().getY());
		g.drawString(l.getCaption().getCaption(), l.getCaption().getPosition().getX()-l.getCaption().getGraphicalLength()/2, l.getCaption().getPosition().getY()-l.getCaption().getGraphicalHeight());
		((Graphics2D )g).rotate(-(l.getCaption().GetAlfa() + java.lang.Math.PI/2), l.getCaption().getPosition().getX(), l.getCaption().getPosition().getY());
*/
	}
	
	public void DrawArrowsLine(Graphics g, ArrowsTextLine l)
	{
	
		float [] tab = new float[10];
		//for (float v : tab)
			//v = 10.0f;
		


		//zmiana koloru na kolor strzalki
		/*g.setColor(new Color(l.getBeginArrow().getArrrowColor().getR()/255,
				l.getBeginArrow().getArrrowColor().getG()/255,
				l.getBeginArrow().getArrrowColor().getB()/255));*/
		g.setColor(new Color(0,0,0));
		((Graphics2D )g).setStroke(new BasicStroke(2.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND));
		//rysowanie left arrow
		g.drawLine(l.getBeginArrow().getBegin().getX(), l.getBeginArrow().getBegin().getY(),
							l.getBeginArrow().getLeft().getX(), l.getBeginArrow().getLeft().getY());
		g.drawLine(l.getBeginArrow().getBegin().getX(), l.getBeginArrow().getBegin().getY(),
				l.getBeginArrow().getRight().getX(), l.getBeginArrow().getRight().getY());
		/*g.drawString("punkty k.linii: " +l.getBeginArrow().getBegin().getX().toString() + " " 
														+ l.getBeginArrow().getBegin().getY().toString() + " " + 
							"linia Arrow p: " + l.getBeginArrow().getLeft().getX().toString() + " " 
							+ l.getBeginArrow().getLeft().getY().toString() , 50, 50);
		*///rysowanie right arrow
		g.drawLine(l.getEndArrow().getBegin().getX(), l.getEndArrow().getBegin().getY(),
				l.getEndArrow().getLeft().getX(), l.getEndArrow().getLeft().getY());
		g.drawLine(l.getEndArrow().getBegin().getX(), l.getEndArrow().getBegin().getY(),
				l.getEndArrow().getRight().getX(), l.getEndArrow().getRight().getY());
		/*g.drawString("punkty k.linii: " +l.getEndArrow().getBegin().getX().toString() + " " 
											+ l.getEndArrow().getBegin().getY().toString() + " " + 
				"linia Arrow p: " + l.getEndArrow().getLeft().getX().toString() + " " 
				+ l.getEndArrow().getLeft().getY().toString() , 50, 40);	
		*///rysowanie textu
		((Graphics2D )g).rotate(l.getCaption().GetAlfa() + java.lang.Math.PI/2, l.getCaption().getPosition().getX(), l.getCaption().getPosition().getY());
		g.drawString(l.getCaption().getCaption(), l.getCaption().getPosition().getX()-l.getCaption().getGraphicalLength()/2, l.getCaption().getPosition().getY()-l.getCaption().getGraphicalHeight());
		((Graphics2D )g).rotate(-(l.getCaption().GetAlfa() + java.lang.Math.PI/2), l.getCaption().getPosition().getX(), l.getCaption().getPosition().getY());

		
		//linia
		for (int i = 0; i < 10; ++i)
			tab[i] = l.getDashing().floatValue();
		
		((Graphics2D )g).setStroke(new BasicStroke(2.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND, 1.0f, tab, 0));
		g.drawLine(l.getBeginX(), l.getBeginY(), l.getEndX(), l.getEndY());
	}
	
	public void DrawInheritanceLine(Graphics g, InheritanceLine l)
	{
	
		//float [] tab = new float[10];
		//for (float v : tab)
			//v = 10.0f;
		
		g.setColor(new Color(0,0,0));
		((Graphics2D )g).setStroke(new BasicStroke(2.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND));

		//zmiana koloru na kolor strzalki
	/*	g.setColor(new Color(l.getBeginArrow().getArrrowColor().getR()/255,
				l.getBeginArrow().getArrrowColor().getG()/255,
				l.getBeginArrow().getArrrowColor().getB()/255));*/
		//rysowanie begin arrow
		g.drawLine(l.getBeginArrow().getBegin().getX(), l.getBeginArrow().getBegin().getY(),
							l.getBeginArrow().getLeft().getX(), l.getBeginArrow().getLeft().getY());
		g.drawLine(l.getBeginArrow().getBegin().getX(), l.getBeginArrow().getBegin().getY(),
				l.getBeginArrow().getRight().getX(), l.getBeginArrow().getRight().getY());
		
		g.drawLine(l.getBeginArrow().getLeft().getX(), l.getBeginArrow().getLeft().getY(),
				l.getBeginArrow().getRight().getX(), l.getBeginArrow().getRight().getY());
		/*g.drawString("punkty k.linii: " +l.getBeginArrow().getBegin().getX().toString() + " " 
														+ l.getBeginArrow().getBegin().getY().toString() + " " + 
							"linia Arrow p: " + l.getBeginArrow().getLeft().getX().toString() + " " 
							+ l.getBeginArrow().getLeft().getY().toString() , 50, 50);
		*///rysowanie end arrow
		g.drawLine(l.getEndArrow().getBegin().getX(), l.getEndArrow().getBegin().getY(),
				l.getEndArrow().getLeft().getX(), l.getEndArrow().getLeft().getY());
		g.drawLine(l.getEndArrow().getBegin().getX(), l.getEndArrow().getBegin().getY(),
				l.getEndArrow().getRight().getX(), l.getEndArrow().getRight().getY());
		
		g.drawLine(l.getEndArrow().getLeft().getX(), l.getEndArrow().getLeft().getY(),
				l.getEndArrow().getRight().getX(), l.getEndArrow().getRight().getY());
		/*g.drawString("punkty k.linii: " +l.getEndArrow().getBegin().getX().toString() + " " 
											+ l.getEndArrow().getBegin().getY().toString() + " " + 
				"linia Arrow p: " + l.getEndArrow().getLeft().getX().toString() + " " 
				+ l.getEndArrow().getLeft().getY().toString() , 50, 40);	
		*///rysowanie textu
		((Graphics2D )g).rotate(l.getCaption().GetAlfa() + java.lang.Math.PI/2, l.getCaption().getPosition().getX(), l.getCaption().getPosition().getY());
		g.drawString(l.getCaption().getCaption(), l.getCaption().getPosition().getX()-l.getCaption().getGraphicalLength()/2, l.getCaption().getPosition().getY()-l.getCaption().getGraphicalHeight());
		((Graphics2D )g).rotate(-(l.getCaption().GetAlfa() + java.lang.Math.PI/2), l.getCaption().getPosition().getX(), l.getCaption().getPosition().getY());

		
		//linia
	//	for (int i = 0; i < 10; ++i)
	//		tab[i] = l.getDashing().floatValue();
		
	//	((Graphics2D )g).setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND, 1.0f, tab, 0));
		g.drawLine(l.getBeginX(), l.getBeginY(), l.getEndX(), l.getEndY());
		Polygon p = new Polygon();
		p.addPoint(l.getEndArrow().getBegin().getX(), l.getEndArrow().getBegin().getY());
		p.addPoint(l.getEndArrow().getLeft().getX(), l.getEndArrow().getLeft().getY());
		p.addPoint(l.getEndArrow().getRight().getX(), l.getEndArrow().getRight().getY());
		g.fillPolygon(p);
	}
	
	public void DrawRealizeLine(Graphics g, RealizeLine l)
	{
	
		float [] tab = new float[10];
	//for (float v : tab)
			//v = 10.0f;
		

		g.setColor(new Color(0,0,0));
		((Graphics2D )g).setStroke(new BasicStroke(2.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND));
		//zmiana koloru na kolor strzalki
	/*	g.setColor(new Color(l.getBeginArrow().getArrrowColor().getR()/255,
				l.getBeginArrow().getArrrowColor().getG()/255,
				l.getBeginArrow().getArrrowColor().getB()/255));*/
		//rysowanie begin arrow
		g.drawLine(l.getBeginArrow().getBegin().getX(), l.getBeginArrow().getBegin().getY(),
							l.getBeginArrow().getLeft().getX(), l.getBeginArrow().getLeft().getY());
		g.drawLine(l.getBeginArrow().getBegin().getX(), l.getBeginArrow().getBegin().getY(),
				l.getBeginArrow().getRight().getX(), l.getBeginArrow().getRight().getY());
		
		g.drawLine(l.getBeginArrow().getLeft().getX(), l.getBeginArrow().getLeft().getY(),
				l.getBeginArrow().getRight().getX(), l.getBeginArrow().getRight().getY());
		/*g.drawString("punkty k.linii: " +l.getBeginArrow().getBegin().getX().toString() + " " 
														+ l.getBeginArrow().getBegin().getY().toString() + " " + 
							"linia Arrow p: " + l.getBeginArrow().getLeft().getX().toString() + " " 
							+ l.getBeginArrow().getLeft().getY().toString() , 50, 50);
		*///rysowanie end arrow
		g.drawLine(l.getEndArrow().getBegin().getX(), l.getEndArrow().getBegin().getY(),
				l.getEndArrow().getLeft().getX(), l.getEndArrow().getLeft().getY());
		g.drawLine(l.getEndArrow().getBegin().getX(), l.getEndArrow().getBegin().getY(),
				l.getEndArrow().getRight().getX(), l.getEndArrow().getRight().getY());
		
		g.drawLine(l.getEndArrow().getLeft().getX(), l.getEndArrow().getLeft().getY(),
				l.getEndArrow().getRight().getX(), l.getEndArrow().getRight().getY());
		/*g.drawString("punkty k.linii: " +l.getEndArrow().getBegin().getX().toString() + " " 
											+ l.getEndArrow().getBegin().getY().toString() + " " + 
				"linia Arrow p: " + l.getEndArrow().getLeft().getX().toString() + " " 
				+ l.getEndArrow().getLeft().getY().toString() , 50, 40);	
		*///rysowanie textu
		((Graphics2D )g).rotate(l.getCaption().GetAlfa() + java.lang.Math.PI/2, l.getCaption().getPosition().getX(), l.getCaption().getPosition().getY());
		g.drawString(l.getCaption().getCaption(), l.getCaption().getPosition().getX()-l.getCaption().getGraphicalLength()/2, l.getCaption().getPosition().getY()-l.getCaption().getGraphicalHeight());
		((Graphics2D )g).rotate(-(l.getCaption().GetAlfa() + java.lang.Math.PI/2), l.getCaption().getPosition().getX(), l.getCaption().getPosition().getY());

		
		//linia
		for (int i = 0; i < 10; ++i)
			tab[i] = l.getDashing().floatValue();
		
		((Graphics2D )g).setStroke(new BasicStroke(2.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND, 1.0f, tab, 0));
		g.drawLine(l.getBeginX(), l.getBeginY(), l.getEndX(), l.getEndY());
		Polygon p = new Polygon();
		p.addPoint(l.getEndArrow().getBegin().getX(), l.getEndArrow().getBegin().getY());
		p.addPoint(l.getEndArrow().getLeft().getX(), l.getEndArrow().getLeft().getY());
		p.addPoint(l.getEndArrow().getRight().getX(), l.getEndArrow().getRight().getY());
		g.fillPolygon(p);
	}
	
	public void DrawRefineLine(Graphics g, RefineLine l)
	{
	
		float [] tab = new float[10];
	//for (float v : tab)
			//v = 10.0f;
		

		g.setColor(new Color(0,0,0));
		((Graphics2D )g).setStroke(new BasicStroke(2.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND));
		//zmiana koloru na kolor strzalki
		g.setColor(new Color(l.getBeginArrow().getArrrowColor().getR()/255,
				l.getBeginArrow().getArrrowColor().getG()/255,
				l.getBeginArrow().getArrrowColor().getB()/255));
		//rysowanie begin arrow
		g.drawLine(l.getBeginArrow().getBegin().getX(), l.getBeginArrow().getBegin().getY(),
							l.getBeginArrow().getLeft().getX(), l.getBeginArrow().getLeft().getY());
		g.drawLine(l.getBeginArrow().getBegin().getX(), l.getBeginArrow().getBegin().getY(),
				l.getBeginArrow().getRight().getX(), l.getBeginArrow().getRight().getY());
		
		g.drawLine(l.getBeginArrow().getLeft().getX(), l.getBeginArrow().getLeft().getY(),
				l.getBeginArrow().getRight().getX(), l.getBeginArrow().getRight().getY());
		/*g.drawString("punkty k.linii: " +l.getBeginArrow().getBegin().getX().toString() + " " 
														+ l.getBeginArrow().getBegin().getY().toString() + " " + 
							"linia Arrow p: " + l.getBeginArrow().getLeft().getX().toString() + " " 
							+ l.getBeginArrow().getLeft().getY().toString() , 50, 50);
		*///rysowanie end arrow
		g.drawLine(l.getEndArrow().getBegin().getX(), l.getEndArrow().getBegin().getY(),
				l.getEndArrow().getLeft().getX(), l.getEndArrow().getLeft().getY());
		g.drawLine(l.getEndArrow().getBegin().getX(), l.getEndArrow().getBegin().getY(),
				l.getEndArrow().getRight().getX(), l.getEndArrow().getRight().getY());
		
		/*g.drawLine(l.getEndArrow().getLeft().getX(), l.getEndArrow().getLeft().getY(),
				l.getEndArrow().getRight().getX(), l.getEndArrow().getRight().getY());*/
		/*g.drawString("punkty k.linii: " +l.getEndArrow().getBegin().getX().toString() + " " 
											+ l.getEndArrow().getBegin().getY().toString() + " " + 
				"linia Arrow p: " + l.getEndArrow().getLeft().getX().toString() + " " 
				+ l.getEndArrow().getLeft().getY().toString() , 50, 40);	
		*///rysowanie textu
		((Graphics2D )g).rotate(l.getCaption().GetAlfa() + java.lang.Math.PI/2, l.getCaption().getPosition().getX(), l.getCaption().getPosition().getY());
		g.drawString(l.getCaption().getCaption(), l.getCaption().getPosition().getX()-l.getCaption().getGraphicalLength()/2, l.getCaption().getPosition().getY()-l.getCaption().getGraphicalHeight());
		((Graphics2D )g).rotate(-(l.getCaption().GetAlfa() + java.lang.Math.PI/2), l.getCaption().getPosition().getX(), l.getCaption().getPosition().getY());

		
		//linia
		for (int i = 0; i < 10; ++i)
			tab[i] = l.getDashing().floatValue();
		
		((Graphics2D )g).setStroke(new BasicStroke(2.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND, 1.0f, tab, 0));
		g.drawLine(l.getBeginX(), l.getBeginY(), l.getEndX(), l.getEndY());
		/*Polygon p = new Polygon();
		p.addPoint(l.getEndArrow().getBegin().getX(), l.getEndArrow().getBegin().getY());
		p.addPoint(l.getEndArrow().getLeft().getX(), l.getEndArrow().getLeft().getY());
		p.addPoint(l.getEndArrow().getRight().getX(), l.getEndArrow().getRight().getY());
		g.fillPolygon(p);*/
	}
	
	public void DrawBorderAreaUsesSelection(Graphics g, BorderAreaUses b)
	{
	
		//float [] tab = new float[10];
		//for (float v : tab)
			//v = 10.0f;



		//zmiana koloru na kolor strzalki
		/*g.setColor(new Color(b.getBeginArrow().getArrrowColor().getR()/255,
				l.getBeginArrow().getArrrowColor().getG()/255,
				l.getBeginArrow().getArrrowColor().getB()/255));*/
		//rysowanie begin arrow
		((Graphics2D )g).setStroke(new BasicStroke(4.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND));
		g.setColor(new Color(255,0,0,100));
		g.getFont().deriveFont(g.getFont().BOLD);
		
		g.drawLine(b.getLeftUp().getX(), b.getLeftUp().getY(), b.getLeftDown().getX(), b.getLeftDown().getY());
		g.drawLine(b.getLeftDown().getX(), b.getLeftDown().getY(), b.getRightDown().getX(), b.getRightDown().getY());
		g.drawLine(b.getRightDown().getX(), b.getRightDown().getY(), b.getRightUp().getX(), b.getRightUp().getY());
		g.drawLine(b.getRightUp().getX(), b.getRightUp().getY(), b.getLeftUp().getX(), b.getLeftUp().getY());
		
		//rysowanie textu
		
		g.drawString(b.getName().getCaption(), b.getName().getPosition().getX(), b.getName().getPosition().getY());
		

		
		//linia
	/*	for (int i = 0; i < 10; ++i)
			tab[i] = l.getDashing().floatValue();
		
		((Graphics2D )g).setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND, 1.0f, tab, 0));
		g.drawLine(l.getBeginX(), l.getBeginY(), l.getEndX(), l.getEndY());*/
		
	}
	
	public void DrawBorderAreaUses(Graphics g, BorderAreaUses b)
	{
	
		//float [] tab = new float[10];
		//for (float v : tab)
			//v = 10.0f;
		

		g.setColor(new Color(0,0,0));
		((Graphics2D )g).setStroke(new BasicStroke(2.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND));
		//zmiana koloru na kolor strzalki
		/*g.setColor(new Color(b.getBeginArrow().getArrrowColor().getR()/255,
				l.getBeginArrow().getArrrowColor().getG()/255,
				l.getBeginArrow().getArrrowColor().getB()/255));*/
		//rysowanie begin arrow
		g.drawLine(b.getLeftUp().getX(), b.getLeftUp().getY(), b.getLeftDown().getX(), b.getLeftDown().getY());
		g.drawLine(b.getLeftDown().getX(), b.getLeftDown().getY(), b.getRightDown().getX(), b.getRightDown().getY());
		g.drawLine(b.getRightDown().getX(), b.getRightDown().getY(), b.getRightUp().getX(), b.getRightUp().getY());
		g.drawLine(b.getRightUp().getX(), b.getRightUp().getY(), b.getLeftUp().getX(), b.getLeftUp().getY());
		
		//rysowanie textu
		
		g.drawString(b.getName().getCaption(), b.getName().getPosition().getX(), b.getName().getPosition().getY());
		

		
		//linia
	/*	for (int i = 0; i < 10; ++i)
			tab[i] = l.getDashing().floatValue();
		
		((Graphics2D )g).setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND, 1.0f, tab, 0));
		g.drawLine(l.getBeginX(), l.getBeginY(), l.getEndX(), l.getEndY());*/
		
	}
	
	public void DrawElipse(Graphics g, Elipse e)
	{
		Integer width = e.getToPoint().getX() - e.getFromPoint().getX();
		Integer height = e.getToPoint().getY() - e.getFromPoint().getY();
		((Graphics2D )g).drawOval(e.getFromPoint().getX(), e.getFromPoint().getY(),
											width, height);
	}
	
	public void DrawActor(Graphics g, Actor a)
	{
		
		g.setColor(new Color(0,0,0));
		((Graphics2D )g).setStroke(new BasicStroke(2.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND));
		
		g.drawLine(a.getLeftLeg().getBeginX(), 
						a.getLeftLeg().getBeginY(), 
						a.getLeftLeg().getEndX(), 
						a.getLeftLeg().getEndY());
		g.drawLine(a.getRightLeg().getBeginX(), 
				a.getRightLeg().getBeginY(), 
				a.getRightLeg().getEndX(), 
				a.getRightLeg().getEndY());
		g.drawLine(a.getHands().getBeginX(), 
				a.getHands().getBeginY(), 
				a.getHands().getEndX(), 
				a.getHands().getEndY());
		g.drawLine(a.getTorso().getBeginX(), 
				a.getTorso().getBeginY(), 
				a.getTorso().getEndX(), 
				a.getTorso().getEndY());
		
		g.drawOval(a.getHead().getFromPoint().getX(), 
						a.getHead().getFromPoint().getY(), 
						a.getHead().getToPoint().getX() - a.getHead().getFromPoint().getX(), 
						a.getHead().getToPoint().getY() - a.getHead().getFromPoint().getY());
	
		g.drawString(a.getName().getCaption(), a.getName().getPosition().getX(), a.getName().getPosition().getY());
		
		
		//sg.drawString(iterator, x, y)

		
	}
	
	public void DrawActorSelection(Graphics g, Actor a)
	{
		//left line
		float [] tab = new float[10];
		for (int i = 0; i < 10; ++i)
			tab[i] = 8.0f;

		((Graphics2D )g).setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND, 1.0f, tab, 0));
		g.setColor(new Color(100,100,100));
		g.drawRect(a.getPositionX() -5, a.getPositionY() -5, a.getWidth()+10, a.getHeight() + 10);
	
		//up line
		/*g.drawLine(a.getPositionX()-5, a.getPositionY()-5, a.getPositionX() + a.getWidth()+5, a.getPositionY()-5);
		//right line
		g.drawLine(a.getPositionX() + a.getWidth()+5, a.getPositionY()-5, a.getPositionX() + a.getWidth()+5, a.getPositionY() + a.getHeight()+5);
		//down line
		g.drawLine(a.getPositionX()-5, a.getPositionY() + a.getHeight(), a.getPositionX() + a.getWidth(), a.getPositionY() + a.getHeight());
		*/
		
		
		
	}
	
	public void DrawUseCase(Graphics g, UseCase uc)
	{
		g.setColor(new Color(0,0,0));
		((Graphics2D )g).setRenderingHint(RenderingHints.KEY_ANTIALIASING,
				RenderingHints.VALUE_ANTIALIAS_ON);
		((Graphics2D )g).setStroke(new BasicStroke(2.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND));
		g.drawOval(uc.getPositionX(), uc.getPositionY(), uc.getWidth(), uc.getHeight());
		AttributedString as = new AttributedString(uc.getUseCaseName());
		as.addAttribute(TextAttribute.SIZE , uc.getUseCaseNameSize());
		g.setColor(new Color(new Float(0.0),new Float(1.0),new Float(0.5),new Float(1.0)));
		Double posx = uc.getPositionX() + uc.getWidth()/2 - uc.getUseCaseName().length()*uc.getUseCaseNameSize()*0.275;
		Double posy = uc.getPositionY() + uc.getHeight()/2 +uc.getUseCaseNameSize()*0.4;
		g.setColor(new Color(new Float(0.0),new Float(0.1),new Float(0.5),new Float(1.0)));
		//g.fillOval(uc.getPositionX(), uc.getPositionY(), uc.getWidth(), uc.getHeight());
		g.setColor(new Color(0,0,0));
		
		g.drawString(as.getIterator(), posx.intValue(), posy.intValue());
	}
	
	public void DrawUseCaseSelection(Graphics g, UseCase uc)
	{
		float [] tab = new float[10];
		for (int i = 0; i < 10; ++i)
			tab[i] = 8.0f;

		((Graphics2D )g).setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND, 1.0f, tab, 0));
		g.setColor(new Color(100,100,100));
		g.drawOval(uc.getPositionX()-5, uc.getPositionY()-5, uc.getWidth()+10, uc.getHeight()+10);
	}
	
	public void DrawSelectionRect(Graphics g,SelectionRect sr)
	{
		float [] tab = new float[10];
		for (int i = 0; i < 10; ++i)
			tab[i] = 10000.0f;

		((Graphics2D )g).setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND, 1.0f, tab, 0));
		g.setColor(new Color(0,100,0));
		System.out.println("X: " + sr.getX() + " Y: " + sr.getY() + " W: " + sr.getW() + " H:" + sr.getH());
		g.drawRect(sr.getX(), sr.getY(), sr.getW(), sr.getH());
	}
	
	public void DrawGrid(Graphics g, Integer grid)
	{
		for (int i = 0; i < (2000/grid); ++i)
		{
			g.setFont(new java.awt.Font ("Helvetica", 0, 8));
			//vertical grid
			g.drawLine(i*grid, 0, i*grid, 2000);
			g.drawString(new Integer(i*grid).toString(), i*grid, 10);
			
			//horizontal grid
			g.drawLine(0, i*grid, 2000, i*grid);
			g.drawString(new Integer(i*grid).toString(), 10, i*grid);
			
		}
			
	}
	
	public void DrawUseCaseDashed(Graphics g, UseCase uc)
	{
		g.setColor(new Color(0,0,0));
		((Graphics2D )g).setStroke(new BasicStroke(2.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND));
		
		AttributedString as = new AttributedString(uc.getUseCaseName());
		as.addAttribute(TextAttribute.SIZE , uc.getUseCaseNameSize());
	//g.setColor(new Color(new Float(0.0),new Float(1.0),new Float(0.5),new Float(1.0)));
		Double posx = uc.getPositionX() + uc.getWidth()/2 - uc.getUseCaseName().length()*uc.getUseCaseNameSize()*0.275;
		Double posy = uc.getPositionY() + uc.getHeight()/2 +uc.getUseCaseNameSize()*0.4;
		//g.setColor(new Color(new Float(0.0),new Float(0.1),new Float(0.5),new Float(1.0)));
		//g.fillOval(uc.getPositionX(), uc.getPositionY(), uc.getWidth(), uc.getHeight());
		//g.setColor(new Color(new Float(0.0),new Float(1.0),new Float(0.0),new Float(1.0)));
		g.drawString(as.getIterator(), posx.intValue(), posy.intValue());
		float [] tab = new float[10];
			for (int i = 0; i < 10; ++i)
		tab[i] = 8.0f;
	
	((Graphics2D )g).setStroke(new BasicStroke(2.0f, BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND, 1.0f, tab, 0));
	g.drawOval(uc.getPositionX(), uc.getPositionY(), uc.getWidth(), uc.getHeight());
		
		
	}
}

